package com.itheima.thread.卖票案例;
/*
    多线程环境下出现的安全问题的原因
        1.是多线程环境
        2.有临界资源【多个线程操作同一份资源】
        3.有多条语句操作临界资源

 */
public class Demo {
    public static void main(String[] args) {
        /*
        //卖票任务
        Ticket ticket = new Ticket();
        //创建线程
        Thread t1 = new Thread(ticket);
        Thread t2 = new Thread(ticket);
        Thread t3 = new Thread(ticket);
        */
        Thread t1 = new TicketThread();
        Thread t2 = new TicketThread();
        Thread t3 = new TicketThread();
        //命名
        t1.setName("窗口一");
        t2.setName("窗口二");
        t3.setName("窗口三");
        //启动线程
        t1.start();
        t2.start();
        t3.start();

    }
}
